<!--{template /module/admin/view/head}-->
<div id="left_layout">
	<div id="main_content" class="container-fluid">
		<!--{template /module/admin/view/head_nav}-->
		<div class="row-fluid">
			<form method="post" action="{$ADMIN_SCRIPT}/admin/menu/{$dispatches[method]}&id={$_var[gp_id]}&parentid={$_var[gp_parentid]}" onsubmit="javascript:return check_form(this);">
			<input type="hidden" name="formsubmit" value="yes" />
			
			<div class="well widget">
				<div class="widget-header">
					<p class="text">* {lang admin.validate.require}</p>
				</div>
				<div class="widget-content">
				<fieldset>
					<label>{lang admin.menu_edit.view.parent.label}</label>
					<span class="muted"><!--{if $parent !== null}-->{$parent[CNAME]}<!--{else}-->{lang admin.menu_edit.view.parent.empty}<!--{/if}--></span>
					<hr/>
					
					<label>{lang admin.menu_edit.view.no.label} *</label>
					<input type="text" class="input-mini" name="txtDisplayOrder" placeholder="{lang admin.menu_edit.view.no.placeholder}..." maxlength="3" value="{$menu[DISPLAYORDER]}" /> 
					<span class="help-inline">{lang admin.menu_edit.view.no.tips}</span>
					
					<label>{lang admin.menu_edit.view.cname.label} *</label>
					<input type="text" class="input-large" name="txtCName" placeholder="{lang admin.menu_edit.view.cname.placeholder}..." maxlength="50" value="{$menu[CNAME]}" /> 
					<span class="help-inline">{lang admin.menu_edit.view.cname.tips}</span>
					
					<label>{lang admin.menu_edit.view.link.label}</label>
					<input type="text" class="input-xxlarge" name="txtUrl" placeholder="{lang admin.menu_edit.view.link.placeholder}..." maxlength="100" value="{$menu[URL]}" /> 
					<span class="help-inline">{lang admin.menu_edit.view.link.tips}</span>
					
					<label>{lang admin.menu_edit.view.remark.label}</label>
					<textarea class="span6" rows="3" name="txtRemark">{$menu[REMARK]}</textarea>
					<span class="help-inline">{lang admin.menu_edit.view.remark.tips}</span>
				</fieldset>
				
				<!--{if !$parent}-->
				<h4>{lang admin.menu_edit.view.type.label}</h4>
				
				<hr/>
				<label class="checkbox inline">
					<input type="radio" class="fancy" name="rdoType" value="0" {if !$menu['TYPE']}checked="checked"{/if} /> {lang admin.menu_edit.view.type.0}
				</label>
				<label class="checkbox inline">
					<input type="radio" class="fancy" name="rdoType" value="1" {if $menu['TYPE'] == 1}checked="checked"{/if} /> {lang admin.menu_edit.view.type.1}
				</label>
				<label class="checkbox inline">
					<input type="radio" class="fancy" name="rdoType" value="2" {if $menu['TYPE'] == 2}checked="checked"{/if} /> {lang admin.menu_edit.view.type.2}
				</label>
				<!--{/if}-->
				
				<h4>{lang admin.menu_edit.view.icon.label}</h4>
				<hr/>
				<fieldset>
					<!--{loop $micro_icons $key $micro_icon}-->
					<label class="checkbox inline" style="margin:0px; width:60px;">
					<input class="fancy" name="rdoIcon" style="opacity: 0;" type="radio" value="{$micro_icon}" {if $menu[ICON] == $micro_icon}checked="checked"{/if}/><i class="micon {$micro_icon}"></i> 
					</label>
					<!--{/loop}-->
				</fieldset>
                
				<h4>{lang admin.menu_edit.view.operation.label}</h4>
				
				<hr/>
				<fieldset id="menu_operations">
					<!--{loop $operation_list $key $operation}-->
					<label class="checkbox inline">
					<input type="checkbox" class="fancy" name="operations[{$key}]" value="1" {if $menu[OPERATIONS][$key]}checked="checked"{/if} /> {$operation}
					</label>
					<!--{/loop}-->
					<br class="clear"/>
				</fieldset>
				
				<hr/>
				<!--{if $dispatches['method'] == '_add'}-->
				<button type="submit" class="btn btn-small btn-primary" {$dispatches[operations][add]}>{lang admin.operation.submit}</button>
				<!--{elseif $dispatches['method'] == '_update'}-->
				<button type="submit" class="btn btn-small btn-primary" {$dispatches[operations][edit]}>{lang admin.operation.submit}</button>
				<!--{/if}-->
				<button type="reset" class="btn btn-small">{lang admin.operation.reset}</button>
				<button type="button" class="btn btn-small" onclick="javascript:location.href='{$ADMIN_SCRIPT}/admin/menu&parentid={$_var[gp_parentid]}';">{lang admin.operation.go.back}</button>
			</div>
		</div>
        </form>
	</div>
</div>

<script>
function check_form(frm){
    if(frm.txtDisplayOrder.value.trim().length == 0){
    	$(frm.txtDisplayOrder).next('.help-inline').css('color', 'red');
    	frm.txtDisplayOrder.focus();
    	return false;
    }
    
    if(!frm.txtDisplayOrder.value.trim().isInt()){
    	$(frm.txtDisplayOrder).next('.help-inline').css('color', 'red');
    	frm.txtDisplayOrder.focus();
    	return false;
    }
    
    if(frm.txtCName.value.trim().length == 0){
    	$(frm.txtCName).next('.help-inline').css('color', 'red');
    	frm.txtCName.focus();
    	return false;
    }
    
    return true;
}

$(function(){
	$('.fancy').uniform();
	
	$('fieldset input,textarea,select').blur(function(){
		$(this).next('.help-inline').css('color', '#333');
	});
});
</script>

<!--{template /module/admin/view/foot}-->